#define _CRT_SECURE_NO_WARNINGS 1
#include"SIMS.h"

int main()
{
	printf("@BuiDer 2024\n\n");
	//Create a block of memory to store students' infomation
	Student stu;

	int input = 0, cnt = 1;
	
	//Initializes the information and selects whether to read the last data
	InitInformation(&stu);

	//Funcion block
	while (1)
	{
		printf("\n\n->The program runs for the %d time\n", cnt);
		input = Menu();
		
		switch (input)
		{
		case 1: //add
			//Adds a specified amount of data
			AddInformation(&stu);
			break;
		case 2: //delete
			DelInformation(&stu);
			break;
		case 3: //search
			SearchInformation(&stu);
			break;
		case 4: //modify
			ModifyInformation(&stu);
			break;
		case 5: //sort
			DoSort(&stu);
			break;
		case 6: //print
			PrintInformation(&stu);
			break;
		case 0: //exit
			//Save data to local file
			SaveData(&stu);
			//free memory
			FreeMemory(&stu);
			exit(0);
			break;
		default:
			printf("Invalid input!");
			break;
		}
		cnt++;
	}
}